﻿using System.ComponentModel.DataAnnotations;
using SqlSugar;
using Newtonsoft.Json;

namespace UnityTemplate.Repository
{
    /// <summary>
    /// 用户信息（用户表）
    /// </summary>
    [SugarTable("t_base_user")]
    public class BaseUserInfos : BaseDataTable
    {
        [Newtonsoft.Json.JsonConverter(typeof(ValueToStringConverter))]
        [SugarColumn(IsPrimaryKey = true)]
        public long Id { get; set; }
       
        /// <summary>
        /// 登录账户名
        /// </summary>        
        public string Account { get; set; }

        public string UserName { get; set; }

        [SugarColumn(Length = 32)]
        public string Password { get; set; }

        [SugarColumn(Length = 1)]
        public Sex Sex { get; set; }

        [Phone]
        [SugarColumn(Length = 11)]
        public string MobilePhone { get; set; }

        [EmailAddress]
        public string Email { get; set; }

        /// <summary>
        /// 部门ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public long DepartId { get; set; }
        /// <summary>
        /// 所属部门
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public DepartmentInfo Department { get; set; }
        /// <summary>
        /// 角色ID
        /// </summary>
        [SugarColumn(IsNullable = true)]
        public long RoleId { get; set; }
        /// <summary>
        /// 用户角色
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public UserRole Role { get; set; }

    }
}
